import {
    http,
    defaultSuccess,
    defaultError
}
    from "@/plugins/axios";

export default {
    /**
     * 权限列表
     * @param page
     * @param success
     * @param error
     */
    list(page, success = defaultSuccess, error = defaultError) {
        http.get("/permission/list", {params: {page: page}}).then(success).catch(error)
    },
    /**
     * 搜索
     * @param page
     * @param success
     * @param error
     */
    search(key, page, success = defaultSuccess, error = defaultError) {
        http.get("/permission/search", {
            params: {
                key: key,
                page: page
            }
        }).then(success).catch(error)
    },
    /**
     * 添加
     * @param param
     * @param success
     * @param error
     */
    save(param, success = defaultSuccess, error = defaultError) {
        http.post("/permission/add", param).then(success).catch(error);
    },
    /**
     * 更新
     * @param param
     * @param success
     * @param error
     */
    update(param, success = defaultSuccess, error = defaultError) {
        http.post("/permission/edit", param).then(success).catch(error);
    },
    /**
     * 删除
     * @param id
     * @param success
     * @param error
     */
    delete(id, success = defaultSuccess, error = defaultError) {
        http.get("/permission/delete/" + id).then(success).catch(error)
    }

}